home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
X User Tools
/
X User Tools (O'Reilly and Associates)(1994).ISO
/
sun4c
/
archive
/
tcltk.z
/
tcltk
/
man
/
catn
/
array.n
< prev
next >
Wrap
Text File
|
1994-09-20
|
4KB
|
133 lines
array(n) Tcl Built-In Commands
_________________________________________________________________
NAME
array - Manipulate array variables
SYNOPSIS
array _o_p_t_i_o_n _a_r_r_a_y_N_a_m_e ?_a_r_g _a_r_g ...?
_________________________________________________________________
DESCRIPTION
This command performs one of several operations on the vari-
able given by _a_r_r_a_y_N_a_m_e. _A_r_r_a_y_N_a_m_e must be the name of an
existing array variable. The _o_p_t_i_o_n argument determines
what action is carried out by the command. The legal
_o_p_t_i_o_n_s (which may be abbreviated) are:
array anymore _a_r_r_a_y_N_a_m_e _s_e_a_r_c_h_I_d
Returns 1 if there are any more elements left to be
processed in an array search, 0 if all elements have
already been returned. _S_e_a_r_c_h_I_d indicates which search
on _a_r_r_a_y_N_a_m_e to check, and must have been the return
value from a previous invocation of array startsearch.
This option is particularly useful if an array has an
element with an empty name, since the return value from
array nextelement won't indicate whether the search has
been completed.
array donesearch _a_r_r_a_y_N_a_m_e _s_e_a_r_c_h_I_d
This command terminates an array search and destroys
all the state associated with that search. _S_e_a_r_c_h_I_d
indicates which search on _a_r_r_a_y_N_a_m_e to destroy, and
must have been the return value from a previous invoca-
tion of array startsearch. Returns an empty string.
array names _a_r_r_a_y_N_a_m_e
Returns a list containing the names of all of the ele-
ments in the array. If there are no elements in the
array then an empty string is returned.
array nextelement _a_r_r_a_y_N_a_m_e _s_e_a_r_c_h_I_d
Returns the name of the next element in _a_r_r_a_y_N_a_m_e, or
an empty string if all elements of _a_r_r_a_y_N_a_m_e have
already been returned in this search. The _s_e_a_r_c_h_I_d
argument identifies the search, and must have been the
return value of an array startsearch command. Warning:
if elements are added to or deleted from the array,
then all searches are automatically terminated just as
if array donesearch had been invoked; this will cause
array nextelement operations to fail for those
searches.
Tcl 1
array(n) Tcl Built-In Commands
array size _a_r_r_a_y_N_a_m_e
Returns a decimal string giving the number of elements
in the array.
array startsearch _a_r_r_a_y_N_a_m_e
This command initializes an element-by-element search
through the array given by _a_r_r_a_y_N_a_m_e, such that invoca-
tions of the array nextelement command will return the
names of the individual elements in the array. When
the search has been completed, the array donesearch
command should be invoked. The return value is a
search identifier that must be used in array nextele-
ment and array donesearch commands; it allows multiple
searches to be underway simultaneously for the same
array.
KEYWORDS
array, element names, search
Tcl 2